javascript loops explained